package com.tjsinfo.tjsoa.documentationflow.xingzhengfawen.action;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.json.JSONArray;
import org.json.JSONObject;

import com.tjsinfo.tjsoa.common.SessionUser;
import com.tjsinfo.tjsoa.documentationflow.xingzhengfawen.bo.ITXingzhengfawenNeirongBO;
import com.tjsinfo.tjsoa.system.bo.ISystemUserBo;
import com.tjsinfo.tjsoa.system.vo.TSystemUser;

public class SelectHuiQianListAction extends Action{
	private ITXingzhengfawenNeirongBO xingzhengfawenNeirongBO;
	private ISystemUserBo systemUserBo;
	
	
	








	public ISystemUserBo getSystemUserBo() {
		return systemUserBo;
	}






	public void setSystemUserBo(ISystemUserBo systemUserBo) {
		this.systemUserBo = systemUserBo;
	}






	public ITXingzhengfawenNeirongBO getXingzhengfawenNeirongBO() {
		return xingzhengfawenNeirongBO;
	}






	public void setXingzhengfawenNeirongBO(
			ITXingzhengfawenNeirongBO xingzhengfawenNeirongBO) {
		this.xingzhengfawenNeirongBO = xingzhengfawenNeirongBO;
	}






	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
	//	List<TSystemUser> list = xingzhengfawenNeirongBO.selectTsystemUserByUserIdAndDuty("董事长");
	//	List<TSystemUser> dongshilist = xingzhengfawenNeirongBO.selectTsystemUserByUserIdAndDuty("董事");
		List<TSystemUser> zongjinglilist = xingzhengfawenNeirongBO.selectTsystemUserByUserIdAndDuty( "总经理");
	//	List<TSystemUser> dangweishujilist = xingzhengfawenNeirongBO.selectTsystemUserByUserIdAndDuty( "党委书记");
		List<TSystemUser> fuzongjinglilist = xingzhengfawenNeirongBO.selectTsystemUserByUserIdAndDuty("副总经理");
		zongjinglilist.addAll(fuzongjinglilist);
	/*	list.addAll(zongjinglilist);
		list.addAll(dangweishujilist);
		list.addAll(fuzongjinglilist);*/
	/*	Set<TSystemUser> set = new HashSet<TSystemUser>();
		List<TSystemUser> newList = new ArrayList<TSystemUser>();
		for (TSystemUser systemUser2 : list) {
			if (set.add(systemUser2)) {
				newList.add(systemUser2);
			}
		}*/
		JSONArray array = new JSONArray();
		for (TSystemUser systemUser : zongjinglilist) {
			JSONObject object = new JSONObject(systemUser);
			array.put(object);
		}
		response.getWriter().print(array);
		return null;
	}
	
}

